import { Controller } from "../../mvc/core/Controller";
import { IWuXingModule } from "../../../modules/interfaces/IWuXingModule";
import { SActiveToClient } from "../../../Message/Public/SActiveToClient";
import { JSONHelper } from "../../../com/mui/serialization/json/JSONHelper";
import { IWuXingGroupRefreshModule } from "../../../modules/interfaces/IWuXingGroupRefreshModule";
import { WuXingGroupRefreshModule } from "../../../modules/WuXingGroupRefreshModule";
import { WindowEvent } from "../../component/window/WindowEvent";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { EventName } from "../mvc/EventName";
import { NetDispatcher } from "../../mvc/core/NetDispatcher";
import { ServerCommand } from "../mvc/ServerCommand";
import { DataEvent } from "../events/DataEvent";
import { ItemData } from "../resource/info/ItemData";
import { GameProxy } from "../mvc/GameProxy";
import { Window } from "../../component/window/Window";
import { GameController } from "../mvc/GameController";
import { UpdateCode } from "../../component/gconst/UpdateCode";
import { IView } from "../../mvc/interfaces/IView";
import { WuXingModule } from "../../../modules/WuXingModule";
import { ModuleType } from "../view/common/ModuleType";
import { WuXingRule } from "../rules/WuXingRule";
import { MsgManager } from "../manager/MsgManager";
import { EAttributeRefreshType } from "../../../Message/Game/EAttributeRefreshType";
import { WuXingConfig } from "../resource/WuXingConfig";
import { ECategory } from "../../../Message/Public/ECategory";
import { EProp } from "../../../Message/Public/EProp";
import { GameDefConfig } from "../resource/GameDefConfig";
import { ColorConfig } from "../resource/ColorConfig";
import { Alert } from "../../../com/mui/controls/Alert";
import { Language } from "../../../extend/language/Language";
import { HTMLUtil } from "../../../com/gengine/utils/HTMLUtil";
import { RolePlayer } from "../scene/player/entity/RolePlayer";
import { SystemSetter } from "../view/system/SystemSetter";
import { SWuXingDice } from "../../../Message/Public/SWuXingDice";
import { ItemsUtil } from "../view/shortcuts/item/ItemsUtil";
import { PlayerEvent } from "../scene/events/PlayerEvent";
type int = number;
//class WuXingController
    
    export  class WuXingController extends Controller
    {
       

        /* internal  */onActiveWuxingSpiritOneKeyTimes(arg1: Object): void
        {
            if (isViewShow) 
            {
                (view as IWuXingModule).updateSpiritActiveBtn();
            }
            return;
        }

        /* internal  */onActiveWuxingSpiritOneKey(arg1: Object): void
        {
            var loc1=arg1 as SActiveToClient;
            var loc2=loc1.modulus;
            var loc3;
            if ((loc3 = JSONHelper.deserialize(loc2)) == null) 
            {
                return;
            }
            if (loc3.hasOwnProperty("times")) 
            {
                cache.wuxing.wuxingSpiritInfo.times = loc3["times"];
            }
            if (loc3.hasOwnProperty("count")) 
            {
                cache.wuxing.wuxingSpiritInfo.count = loc3["count"];
            }
            if (loc3.hasOwnProperty("humanCost")) 
            {
                cache.wuxing.wuxingSpiritInfo.humanCost = loc3["humanCost"];
            }
            if (loc3.hasOwnProperty("earthCost")) 
            {
                cache.wuxing.wuxingSpiritInfo.earthCost = loc3["earthCost"];
            }
            if (loc3.hasOwnProperty("skyCost")) 
            {
                cache.wuxing.wuxingSpiritInfo.skyCost = loc3["skyCost"];
            }
            if (loc3.hasOwnProperty("godCost")) 
            {
                cache.wuxing.wuxingSpiritInfo.godCost = loc3["godCost"];
            }
            if (isViewShow) 
            {
                (view as IWuXingModule).updateSpiritActiveBtn();
            }
            return;
        }

        public get isRefreshViewShow(): Boolean
        {
            return this._wxRefreshModule && !this._wxRefreshModule.isHide;
        }

        /* internal  */get wxRefreshModule(): IWuXingGroupRefreshModule
        {
            if (!this._wxRefreshModule) 
            {
                this._wxRefreshModule = new WuXingGroupRefreshModule();
                this._wxRefreshModule.addEventListener(WindowEvent.SHOW, this.onRefreshModuleOpenHandler);
            }
            return this._wxRefreshModule;
        }

        public showRefreshPanel(): void
        {
            if (!isViewShow) 
            {
                view.show();
            }
            this._wxModule.changeTabBarByIndex(0);
            return;
        }

        public showQuailtyPanel(): void
        {
            if (!isViewShow) 
            {
                view.show();
            }
            this._wxModule.changeTabBarByIndex(2);
            return;
        }

        public showLevelUpPanel(): void
        {
            if (!isViewShow) 
            {
                view.show();
            }
            this._wxModule.changeTabBarByIndex(1);
            return;
        }

        /* internal  */onWindowShowHandler(arg1: WindowEvent): void
        {
            this.juHunBtnFlashEffect(false);
            this._wxModule.updateData(cache.role.wuxingInfo);
            this._wxModule.updateBuWuXingDice(cache.role.wuxingInfo.wxDice);
            this.addListener();
            return;
        }

        /* internal  */onWindowCloseHandler(arg1: WindowEvent): void
        {
            this.delListener();
            return;
        }

        /* internal  */onRefreshModuleOpenHandler(arg1: WindowEvent): void
        {
            this.wxRefreshModule.updateData(cache.role.wuxingInfo);
            this.wxRefreshModule.updateWXData(cache.role.wuxingInfo);
            this.wxRefreshModule.updatePackData();
            return;
        }

        /* internal  */addListener(): void
        {
            Dispatcher.addEventListener(EventName.WuXingLevelUpReq, this.onLevelUpReq);
            Dispatcher.addEventListener(EventName.WuXingQualityReq, this.onQualityReq);
            Dispatcher.addEventListener(EventName.WuXingQualityAutoReq, this.onQualityAutoReq);
            Dispatcher.addEventListener(EventName.WuXingSpiritOneKeyAutoReq, this.onWuXingSpiritOneKeyAutoReq);
            Dispatcher.addEventListener(EventName.WuXingQuailtyItem, this.onQualityItemReq);
            Dispatcher.addEventListener(EventName.WuXingRefreshGroupOpenReq, this.onRefreshGroupOpenReq);
            Dispatcher.addEventListener(EventName.WuXingFeedSpiritRes, this.onFeedRes);
            Dispatcher.addEventListener(EventName.WuXingUpgradeSpiritRes, this.onUpgradeRes);
            NetDispatcher.addCmdListener(ServerCommand.MoneyUpdate, this.onMoneyUpdateHandler);
            return;
        }

        /* internal  */onWuXingSpiritOneKeyAutoReq(arg1: DataEvent): void
        {
            var loc1=arg1.data as ItemData;
            if (loc1) 
            {
                GameProxy.wuxing.upgradeSpiritReq(loc1.posType, loc1.uid, false, false, [], true);
            }
            return;
        }

        /* internal  */onActiveWuxingDiceOneKeyTimes(arg1: Object): void
        {
            if (!view.isHide) 
            {
                (view as IWuXingModule).updateLevelUpActiveBtn();
            }
            return;
        }

        /* internal  */onActiveWuxingDiceOneKey(arg1: Object): void
        {
            var loc1=arg1 as SActiveToClient;
            var loc2=loc1.modulus;
            var loc3;
            if ((loc3 = JSONHelper.deserialize(loc2)) == null) 
            {
                return;
            }
            if (loc3.hasOwnProperty("cost")) 
            {
                cache.wuxing.wuxingDiceOneKey.valueStr = loc3["cost"];
            }
            if (loc3.hasOwnProperty("times")) 
            {
                cache.wuxing.wuxingDiceOneKey.value = loc3["times"];
            }
            if (!view.isHide) 
            {
                (view as IWuXingModule).updateLevelUpActiveBtn();
            }
            return;
        }

        /* internal  */delListener(): void
        {
            Dispatcher.removeEventListener(EventName.WuXingLevelUpReq, this.onLevelUpReq);
            Dispatcher.removeEventListener(EventName.WuXingQualityReq, this.onQualityReq);
            Dispatcher.removeEventListener(EventName.WuXingQualityAutoReq, this.onQualityAutoReq);
            Dispatcher.removeEventListener(EventName.WuXingSpiritOneKeyAutoReq, this.onWuXingSpiritOneKeyAutoReq);
            Dispatcher.removeEventListener(EventName.WuXingQuailtyItem, this.onQualityItemReq);
            Dispatcher.removeEventListener(EventName.WuXingRefreshGroupOpenReq, this.onRefreshGroupOpenReq);
            Dispatcher.removeEventListener(EventName.WuXingFeedSpiritRes, this.onFeedRes);
            Dispatcher.removeEventListener(EventName.WuXingUpgradeSpiritRes, this.onUpgradeRes);
            NetDispatcher.removeCmdListener(ServerCommand.MoneyUpdate, this.onMoneyUpdateHandler);
            return;
        }

        /* internal  */onWindowOpenReq(arg1: DataEvent): void
        {
            if (cache.role.entityInfo.level >= 70) 
            {
                if (isViewShow) 
                {
                    view.hide();
                }
                else 
                {
                    view.show();
                    if (cache.role.wuxingInfo.juhunCount > 0) 
                    {
                        this.showLevelUpPanel();
                    }
                }
            }
            return;
        }

        /* internal  */onRefreshModuleOpenReqHandler(arg1: DataEvent): void
        {
            if (view.isHide) 
            {
                view.show();
                this._wxModule.changeTabBarByIndex(0);
                this._wxModule.showEffect();
                (view as Window).layer.centerPopup(view as Window);
            }
            else if (this._wxModule.tabBarIndex == 0) 
            {
                view.hide();
            }
            else 
            {
                this._wxModule.changeTabBarByIndex(0);
            }
            var loc1=arg1.data as string;
            if (!this._wxModule.isHide) 
            {
                if (GameController.player.isModeSelfOpen()) 
                {
                    GameController.player.view.hide();
                }
            }
            return;
        }

        /* internal  */onLevelUpModuleOpenReqHandler(arg1: DataEvent): void
        {
            if (view.isHide) 
            {
                view.show(0, 0);
                this._wxModule.changeTabBarByIndex(1);
                this._wxModule.showEffect();
                (view as Window).layer.centerPopup(view as Window);
            }
            else if (this._wxModule.tabBarIndex != 0) 
            {
                if (this._wxModule.tabBarIndex != 2) 
                {
                    view.hide();
                }
            }
            else 
            {
                this._wxModule.changeTabBarByIndex(1);
            }
            var loc1=arg1.data as string;
            if (!this._wxModule.isHide) 
            {
                if (GameController.player.isModeSelfOpen()) 
                {
                    GameController.player.view.hide();
                }
            }
            return;
        }

        /* internal  */onModuleOpenReqHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            if (this._wxModule.isHide) 
            {
                this._wxModule.show();
            }
            this._wxModule.changeTabBarByIndex(loc1);
            return;
        }

        /* internal  */onQualityItemReq(arg1: DataEvent): void
        {
            var loc1=null;
            if (isViewShow) 
            {
                loc1 = arg1.data as ItemData;
                this._wxModule.onQualityItemReq(loc1);
            }
            return;
        }

        /* internal  */onRefreshGroupOpenReq(arg1: DataEvent): void
        {
            if (this.isRefreshViewShow) 
            {
                this.wxRefreshModule.hide();
            }
            else 
            {
                this.wxRefreshModule.show();
            }
            return;
        }

        /* internal  */onLockMainAttrChange(arg1: DataEvent): void
        {
            if (arg1.data) 
            {
                if (isViewShow) 
                {
                    this._wxModule.onLockMainAttrChange();
                }
            }
            else if (this.isRefreshViewShow) 
            {
                this.wxRefreshModule.onLockMainAttrChange();
            }
            return;
        }

        /* internal  */onAutoBuyChange(arg1: DataEvent): void
        {
            if (arg1.data) 
            {
                if (isViewShow) 
                {
                    this._wxModule.onAutoBuyChange();
                }
            }
            else if (this.isRefreshViewShow) 
            {
                this.wxRefreshModule.onAutoBuyChange();
            }
            return;
        }

        /* internal  */onSpecialActivityRewardShowMsg(arg1: DataEvent): void
        {
            var loc1=arg1.data.str as string;
            var loc2=arg1.data.code as int;
            if ((loc2 == UpdateCode.EUpdateCodeWuXingRefreshAccActive || loc2 == UpdateCode.EUpdateCodeWuXingUpgradeAccActive) && isViewShow) 
            {
                this._wxModule.showMsg(loc1);
            }
            return;
        }

        protected /* override */ initView(): IView
        {
            this._wxModule = new WuXingModule();
            this._wxModule.addEventListener(WindowEvent.SHOW, this.onWindowShowHandler);
            this._wxModule.addEventListener(WindowEvent.CLOSE, this.onWindowCloseHandler);
            return this._wxModule;
        }

        /* internal  */juHunBtnFlashEffect(arg1: Boolean): void
        {
            if (arg1) 
            {
                if (!this._lastEffect) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_ModuleOpen, ModuleType.WuXing));
                    this._lastEffect = true;
                }
            }
            else if (this._lastEffect) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_ModuleHide, ModuleType.WuXing));
                this._lastEffect = false;
            }
            return;
        }

        /* internal  */onWuXingThrowDiceReq(arg1: DataEvent): void
        {
            var loc1=arg1.data.type as int;
            var loc2=arg1.data.isActive as Boolean;
            GameProxy.wuxing.throwTheDice(loc1, loc2);
            return;
        }

        /* internal  */onWuXingThrowDiceRes(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            if (isViewShow && !cache.role.wuxingInfo.isWxDiceSkipAnimation) 
            {
                if (loc1 != 0) 
                {
                    if (loc1 == 1) 
                    {
                        this._wxModule.retry();
                    }
                }
                else 
                {
                    this._wxModule.start();
                }
            }
            return;
        }

        /* internal  */onWuXingValueAddHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            if (isViewShow) 
            {
                this._wxModule.playWuxingValueAddEffect(loc1);
            }
            return;
        }

        /* internal  */onRefreshReq(arg1: DataEvent): void
        {
            var loc1=WuXingRule.getRelationId(cache.role.wuxingInfo.mainAttribute, WuXingRule.Relation_AddFrom);
            var loc2=cache.role.wuxingInfo.getAttrValue(loc1);
            var loc3;
            if ((loc3 = cache.role.wuxingInfo.getAttrValue(cache.role.wuxingInfo.mainAttribute)) >= 90 && loc3 + loc2 >= 100) 
            {
                MsgManager.showRollTipsMsg("五行命脉加成已达到最大限制");
                return;
            }
            if (arg1.data) 
            {
                GameProxy.wuxing.refreshAttributeReq(EAttributeRefreshType._EAttributeRefreshTypeBatch, cache.role.wuxingInfo.autoSelect, cache.role.wuxingInfo.autoBuy);
            }
            else 
            {
                GameProxy.wuxing.refreshAttributeReq(EAttributeRefreshType._EAttributeRefreshTypeSingle, cache.role.wuxingInfo.autoSelect, cache.role.wuxingInfo.autoBuy);
            }
            return;
        }

        /* internal  */onReplaceReq(arg1: DataEvent): void
        {
            if (arg1.data) 
            {
                GameProxy.wuxing.replaceAttributeReq(int(arg1.data));
            }
            else 
            {
                GameProxy.wuxing.replaceAttributeReq();
            }
            return;
        }

        /* internal  */onLevelUpReq(arg1: DataEvent): void
        {
            var loc1=arg1.data as ItemData;
            if (loc1) 
            {
                GameProxy.wuxing.feedSpiritReq(loc1.posType, loc1.uid, WuXingConfig.instance.getBaseJuhunValue());
            }
            return;
        }

        /* internal  */onQualityReq(arg1: DataEvent): void
        {
            var loc2=null;
            var loc1=arg1.data as ItemData;
            if (loc1) 
            {
                loc2 = cache.pack.backPackCache.getUidListByType(ECategory._ECategoryProp, EProp._EPropWuXingSpiritUpgrade);
                GameProxy.wuxing.upgradeSpiritReq(loc1.posType, loc1.uid, false, cache.role.wuxingInfo.qualityAutoBuy, loc2);
            }
            return;
        }

        /* internal  */onQualityAutoReq(arg1: DataEvent): void
        {
            var loc2=null;
            var loc1=arg1.data as ItemData;
            if (loc1) 
            {
                loc2 = cache.pack.backPackCache.getUidListByType(ECategory._ECategoryProp, EProp._EPropWuXingSpiritUpgrade);
                GameProxy.wuxing.upgradeSpiritReq(loc1.posType, loc1.uid, true, cache.role.wuxingInfo.qualityAutoBuy, loc2);
            }
            return;
        }

        /* internal  */onWuXingSkillChangeReq(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            var loc2=GameDefConfig.instance.getWuxingName(loc1);
            var loc3=ColorConfig.instance.getWuxingColor(loc1);
            Alert.extendObj = loc1;
            Alert.show(Language.getStringByParam(26415, HTMLUtil.addColor(loc2 + Language.getString(26383), loc3)), Language.getString(20055), Alert.OK | Alert.CANCEL, null, this.onChangeSkillAlert);
            return;
        }

        /* internal  */onChangeSkillAlert(arg1: int, arg2: int): void
        {
            if (arg1 == Alert.OK) 
            {
                GameProxy.wuxing.skillChangeReq(arg2);
            }
            return;
        }

        /* internal  */onWuXingInfoUpdataHandler(arg1: Object): void
        {
            if (isViewShow) 
            {
                this._wxModule.updateData(cache.role.wuxingInfo);
            }
            return;
        }

        /* internal  */onWuXingAttrUpdataHandler(arg1: Object): void
        {
            if (isViewShow) 
            {
                this._wxModule.updateData(cache.role.wuxingInfo);
            }
            if (this.isRefreshViewShow) 
            {
                this._wxRefreshModule.updateWXData(cache.role.wuxingInfo);
            }
            if (cache.role.wuxingInfo.mainAttribute != 0) 
            {
                cache.role.entityInfo.wuxingType = cache.role.wuxingInfo.mainAttribute;
                RolePlayer.instance.entityInfo.entityInfo.wuxingType = cache.role.wuxingInfo.mainAttribute;
                RolePlayer.instance.wxPlayerShow(!SystemSetter.currentSetter.hideWuxingBeadEffect);
            }
            return;
        }

        /* internal  */onWuXingRefreshUpdateHandler(arg1: Object): void
        {
            if (isViewShow) 
            {
                this._wxModule.updateRefreshAttr(cache.role.wuxingInfo);
            }
            if (this.isRefreshViewShow) 
            {
                this._wxRefreshModule.updateData(cache.role.wuxingInfo);
            }
            return;
        }

        /* internal  */onMoneyUpdateHandler(arg1: Object): void
        {
            if (isViewShow) 
            {
                this._wxModule.updateMoney();
            }
            return;
        }

        /* internal  */onWuXingDiceUpdateCommandHandler(arg1: SWuXingDice): void
        {
            if (isViewShow) 
            {
                this._wxModule.updateJuHunData(cache.role.wuxingInfo);
            }
            var loc1=0;
            if (!cache.role.wuxingInfo.isWxDiceSkipAnimation) 
            {
                loc1 = 2;
            }
            if (isViewShow) 
            {
                (view as IWuXingModule).updateBuWuXingDice(arg1, loc1);
            }
            else if (cache.role.wuxingInfo.juhunCount > 0 && !this.isWuXingEquipMax) 
            {
                this.juHunBtnFlashEffect(true);
            }
            else 
            {
                this.juHunBtnFlashEffect(false);
            }
            return;
        }

        /* internal  */get isWuXingEquipMax(): Boolean
        {
            var loc2=null;
            var loc1=cache.pack.rolePackCache.getAllItems();
            var loc3=0;
            while (loc3 < loc1.length) 
            {
                loc2 = loc1[loc3] as ItemData;
                if (loc2 && ItemsUtil.isEquip(loc2) && (!(loc2.wxColor == 5) || !(loc2.wxLevel == 10))) 
                {
                    return false;
                }
                ++loc3;
            }
            return true;
        }

        /* internal  */onFeedRes(arg1: DataEvent): void
        {
            if (isViewShow) 
            {
                this._wxModule.onLevelGradeRes();
            }
            return;
        }

        /* internal  */onUpgradeRes(arg1: DataEvent): void
        {
            var loc1=false;
            var loc2=0;
            if (isViewShow) 
            {
                loc1 = arg1.data["result"] as Boolean;
                if (loc1) 
                {
                    this._wxModule.onQualityGradeRes();
                }
                loc2 = arg1.data["addLucky"] as int;
                if (loc2 > 5) 
                {
                    this._wxModule.playWuxingLuckyValueAddEffect(loc2);
                }
            }
            return;
        }

        /* internal  */onBackDataChangeHandler(arg1: Object): void
        {
            if (isViewShow) 
            {
                this._wxModule.updateBackPack();
            }
            if (this.isRefreshViewShow) 
            {
                this._wxRefreshModule.updatePackData();
            }
            return;
        }

        /* internal  */onRoleBackChangeHandler(arg1: Object): void
        {
            if (isViewShow) 
            {
                this._wxModule.updateRolePack();
            }
            return;
        }

        protected /* override */ initServer(): void
        {
            super.initServer();
            Dispatcher.addEventListener(EventName.WuXingRefreshModuleOpenReq, this.onRefreshModuleOpenReqHandler);
            Dispatcher.addEventListener(EventName.WuXingLevelUpModuleOpenReq, this.onLevelUpModuleOpenReqHandler);
            Dispatcher.addEventListener(EventName.WuXingModuleOpenReqByIndex, this.onModuleOpenReqHandler);
            Dispatcher.addEventListener(EventName.WuXingAttrRefreshReq, this.onRefreshReq);
            Dispatcher.addEventListener(EventName.WuXingAttrReplaceReq, this.onReplaceReq);
            Dispatcher.addEventListener(EventName.WuXingLockMainAttrChange, this.onLockMainAttrChange);
            Dispatcher.addEventListener(EventName.WuXingAutoBuyChange, this.onAutoBuyChange);
            Dispatcher.addEventListener(EventName.WuXingSkillChangeReq, this.onWuXingSkillChangeReq);
            NetDispatcher.addCmdListener(ServerCommand.WuXingDiceUpdateCommand, this.onWuXingDiceUpdateCommandHandler);
            NetDispatcher.addCmdListener(ServerCommand.BackpackDataChange, this.onBackDataChangeHandler);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsChange, this.onBackDataChangeHandler);
            NetDispatcher.addCmdListener(ServerCommand.RolepackDataChange, this.onRoleBackChangeHandler);
            NetDispatcher.addCmdListener(ServerCommand.RolePackItemsChange, this.onRoleBackChangeHandler);
            NetDispatcher.addCmdListener(ServerCommand.PlayerWuXingInfoUpdate, this.onWuXingInfoUpdataHandler);
            NetDispatcher.addCmdListener(ServerCommand.PlayerWuXingAttrUpdate, this.onWuXingAttrUpdataHandler);
            NetDispatcher.addCmdListener(ServerCommand.PlayerWuXingRefreshUpdate, this.onWuXingRefreshUpdateHandler);
            Dispatcher.addEventListener(EventName.WuXingWindowOpenReq, this.onWindowOpenReq);
            Dispatcher.addEventListener(EventName.WuXingThrowDiceReq, this.onWuXingThrowDiceReq);
            Dispatcher.addEventListener(EventName.WuXingThrowDiceRes, this.onWuXingThrowDiceRes);
            Dispatcher.addEventListener(EventName.WuXingValueAdd, this.onWuXingValueAddHandler);
            NetDispatcher.addCmdListener(ServerCommand.ActiveWuxingDiceOneKey, this.onActiveWuxingDiceOneKey);
            NetDispatcher.addCmdListener(ServerCommand.ActiveWuxingDiceOneKeyTimes, this.onActiveWuxingDiceOneKeyTimes);
            NetDispatcher.addCmdListener(ServerCommand.ActiveWuxingSpiritOneKey, this.onActiveWuxingSpiritOneKey);
            NetDispatcher.addCmdListener(ServerCommand.ActiveWuxingSpiritOneKeyTimes, this.onActiveWuxingSpiritOneKeyTimes);
            RolePlayer.instance.addEventListener(PlayerEvent.RoleLevelUpdate, this.onRoleLevelUpdateHandler);
            Dispatcher.addEventListener(EventName.WuxingShengLingSuccess, this.onWuxingShengLingSuccess);
            Dispatcher.addEventListener(EventName.WuxingShengLingGoRIse, this.onWuxingShengLingGoRIse);
            return;
        }

        /* internal  */onWuxingShengLingGoRIse(arg1: DataEvent): void
        {
            var loc1=arg1.data.equipUid as string;
            var loc2=arg1.data.materials as Array<any>;
            GameProxy.wuxing.equipWuxingShengling(loc1, loc2);
            return;
        }

        /* internal  */onWuxingShengLingSuccess(arg1: DataEvent): void
        {
            var loc1=arg1.data.equipUid as string;
            var loc2=arg1.data.shenglingLevel as int;
            if (!view.isHide) 
            {
                this._wxModule.updateShengLingStart(loc1, loc2);
            }
            return;
        }

        protected onRoleLevelUpdateHandler(arg1: Object /* flash.events.Event */): void
        {
            if (!view.isHide) 
            {
                (view as IWuXingModule).updateRoleLevel();
            }
            return;
        }

        private /* var */_wxModule: IWuXingModule;

        private /* var */_wxRefreshModule: IWuXingGroupRefreshModule;

        private /* var */_lastEffect: Boolean;
    }
